<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="//layui.hcwl520.com.cn/layui/css/layui.css" />
    <script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
    <script src="//layui.hcwl520.com.cn/layui/layui.js"></script>
    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
    <script src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
</head>
<body>
<div id="app" style="width: 100%;height: 100%">
    <div style="width: 50%;height: 50%;float: left;border: 1px solid red">
        <!--<form class="layui-form">-->
            <div class="layui-form-item">
                <label class="layui-form-label">外貌</label>
                <div class="layui-input-inline">
                    <input type="text" name="name" id="name" v-model="wai" required  lay-verify="required" placeholder="请输入姓名" autocomplete="off" class="layui-input">
                </div>
            </div>
        <div class="layui-form-item">
            <label class="layui-form-label">与岗位匹配度</label>
            <div class="layui-input-inline">
                <input type="text" name="name" id="mobile" v-model="pi" required  lay-verify="required" placeholder="请输入电话" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">是否入职</label>
            <div class="layui-input-inline">
                <input type="text" name="name" id="sex" v-model="shi" required  lay-verify="required" placeholder="请输入性别" autocomplete="off" class="layui-input">
            </div>
        </div>
            <div class="layui-form-item">
                <label class="layui-form-label">入职部门</label>
                <div class="layui-input-inline">
                    <input type="text" name="school" id="school" v-model="bu" required  lay-verify="required" placeholder="请输入姓名" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" @click="submit()">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        <!--</form>-->


    </div>
</div>


<script>
    new Vue({
        el: '#app',
        data: {
            message: 'Hello Vue.js!',
            wai:"",
            bu:"",
            shi:"",
            pi:"",
            ids:""
        },
        methods:{
            submit:function () {
                // var parm={};
                // parm["name"] = this.name;
                // parm["sex"] = this.sex;
                // parm["school"] = this.school;
                this.ids = getQueryVariable("ids");
                console.log("ids"+this.ids);
                axios({
                    method: 'post',
                    url: 'http://127.0.0.1:8087/Ding/sendOne',
                    params: {
                        wai: this.wai,
                        pi: this.pi,
                        bu: this.bu,
                        ids: this.ids,
                        shi: this.shi
                    }
                }).then(function(data) {
                    console.log("ids"+data.data.ids)
                    this.ids = data.data.ids;
                    location.href = "http://127.0.0.1:8087/test.html?idTwo="+data.data.ids;
                });
            }
        }
    })
    // function setCookie(cname,cvalue,exdays)
    // {
    //     var d = new Date();
    //     d.setTime(d.getTime()+(exdays*24*60*60*1000));
    //     var expires = "expires="+d.toGMTString();
    //     document.cookie = cname + "=" + cvalue + "; " + expires;
    // }
    //Demo
    // $(".layui-btn").click(function () {
    //     var parm ={};
    //     parm["name"] = $("#name").val;
    //     parm["six"] = $("#six").val;
    //     parm["school"] = $("#school").val;
    //     $.ajax({
    //         url:"http://127.0.0.1:8087/Ding/sendsh",
    //         type:'POST',
    //         dataType:'json',
    //         data : parm,
    //         success:function(result){
    //             console.log("result",result);
    //         },
    //         error:function(data){
    //             alert('cuowu');
    //             alert(data);
    //         }
    //     });
    // })
    function getQueryVariable(variable)
    {
        var query = window.location.search.substring(1);
        var vars = query.split("&");
        for (var i=0;i<vars.length;i++) {
            var pair = vars[i].split("=");
            if(pair[0] == variable){return pair[1];}
        }
        return(false);
    }
    layui.use('form', function(){
        var form = layui.form;

    });
</script>
</body>
</html>